package com.ty.day2;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/7 19:10
 */
public class Task1 {
    public static void main(String[] args) {
        int[] a0 = {'a', 'b', 'c', 2, '_', '3', 'c', 2, '_'};
        int letter = 0, number = 0, underline = 0;
        for (int i = 0; i < a0.length; i++) {
            if (a0[i]>='0'&&a0[i]<='9'||a0[0]==2){//数字判断
                number++;
            }else if (a0[i]>='a'&&a0[i]<='z'||a0[i]>='A'&&a0[i]<='Z'){//考虑大小写的情况
                letter++;
            }else if (a0[i]=='_'){//‘_’判断
                underline++;
            }
        }
        System.out.println("字母："+letter+"个，数字："+number+"个，下划线"+underline+"个");
    }
}
